﻿<UserControl x:Class="nRoute.Samples.Netflix.Views.PersonView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
    xmlns:n="http://nRoute/schemas/2010/xaml" 
	mc:Ignorable="d" FontFamily="Arial" FontSize="16" 
	xmlns:local_Controls="clr-namespace:nRoute.Samples.Netflix.Controls" 
	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
    d:DesignHeight="600" d:DesignWidth="900">
	
	<UserControl.Resources>
		<n:ValueConverterRelay x:Key="LimitListingConverter" />
		<n:ValueConverterRelay x:Key="ListingVisibilityConverter" />
	</UserControl.Resources>
	
	<i:Interaction.Behaviors>
		<n:BridgeViewModelBehavior/>		
	</i:Interaction.Behaviors>
    
    <Grid x:Name="LayoutRoot" Background="WhiteSmoke">
    	<ScrollViewer BorderBrush="{x:Null}" BorderThickness="0" VerticalScrollBarVisibility="Auto" Padding="0">
			<StackPanel Orientation="Vertical" VerticalAlignment="Top" Margin="12">
				<i:Interaction.Behaviors>
					<n:BoolValueVisibilityBehavior Value="{Binding IsLoading}" Negate="True"/>
				</i:Interaction.Behaviors>
				
				<TextBlock FontFamily="Arial" FontSize="32" TextWrapping="Wrap" Text="{Binding Person.Name}" Margin="5,0,0,0" />
				
				<TextBlock Text="Movies In" Margin="5,10,0,5" Foreground="#FF85878B" HorizontalAlignment="Left"
					FontSize="16" FontFamily="Trebuchet MS" TextOptions.TextHintingMode="Animated" FontWeight="Bold"
					Visibility="{Binding Person.TitlesActedIn, Converter={StaticResource ListingVisibilityConverter}}">
					<TextBlock.Effect>
						<DropShadowEffect ShadowDepth="1" BlurRadius="2" Color="White" Direction="-247"/>
					</TextBlock.Effect>
				</TextBlock>
				
				<ItemsControl BorderThickness="0" Padding="0" 
					ItemsSource="{Binding Person.TitlesActedIn, Converter={StaticResource LimitListingConverter}}" 
					ItemTemplate="{StaticResource TitleItemTemplate}" ItemsPanel="{StaticResource TitlesPanelTemplate}"/>
					
				<Border HorizontalAlignment="Left" Cursor="Hand" Background="#FFE7E7E7" Padding="5" Margin="10,10,0,0"
					Visibility="{Binding Person.TitlesActedIn, Converter={StaticResource ListingVisibilityConverter}}">
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="MouseLeftButtonUp">
							<i:Interaction.Behaviors>
								<ei:ConditionBehavior>
									<ei:ConditionalExpression>
										<ei:ComparisonCondition 
											Operator="NotEqual" RightOperand="-1"/>
									</ei:ConditionalExpression>
								</ei:ConditionBehavior>
							</i:Interaction.Behaviors>
							<n:NavigateAction HandlerName="ContentContainer" Url="Content/Netflix/Titles/" >
								<n:DependencyParameter Key="MovieTitles" Value="{Binding Person.TitlesActedIn}"/>
								<n:DependencyParameter Key="PageTitle" 
									Value="{Binding Person.Name, StringFormat=Movies Acted In: \{0\}}"/>
							</n:NavigateAction>
						</i:EventTrigger>
					</i:Interaction.Triggers>				
					<Grid>
						<TextBlock Margin="24,0,8,0" TextWrapping="NoWrap" FontFamily="Trebuchet MS" TextTrimming="WordEllipsis"
							Text="List All" FontSize="16" Foreground="#FFA7A7A7" VerticalAlignment="Center">
							<TextBlock.Effect>
								<DropShadowEffect ShadowDepth="1" BlurRadius="2" Color="White" Direction="-247"/>
							</TextBlock.Effect>
						</TextBlock>
						<Path Data="M5.2319946,1 L5.312995,10.589 M9.5506897,7.3135071 L4.5906897,12.572507 M1,7.2724915 L5.868,12.572492" 
							HorizontalAlignment="Left" Margin="4,0,0,0" Stretch="Fill" Stroke="#FF8D8C8C" StrokeThickness="2" 
							UseLayoutRounding="False" Width="10.551" Height="13.573" VerticalAlignment="Center"/>
					</Grid>				
				</Border>
				
				<TextBlock Text="Movies Directed" Margin="5,20,0,5" Foreground="#FF85878B" HorizontalAlignment="Left"
					FontSize="16" FontFamily="Trebuchet MS" TextOptions.TextHintingMode="Animated" FontWeight="Bold" 
					Visibility="{Binding Person.TitlesDirected, Converter={StaticResource ListingVisibilityConverter}}">
					<TextBlock.Effect>
						<DropShadowEffect ShadowDepth="1" BlurRadius="2" Color="White" Direction="-247"/>
					</TextBlock.Effect>
				</TextBlock>
				
				<ItemsControl BorderThickness="0" Padding="0" 
					ItemsSource="{Binding Person.TitlesDirected, Converter={StaticResource LimitListingConverter}}"  
					ItemTemplate="{StaticResource TitleItemTemplate}" ItemsPanel="{StaticResource TitlesPanelTemplate}"/>
					
				<Border HorizontalAlignment="Left" Cursor="Hand" Background="#FFE7E7E7" Padding="5" Margin="10,10,0,0"
					Visibility="{Binding Person.TitlesDirected, Converter={StaticResource ListingVisibilityConverter}}">
					<i:Interaction.Triggers>
						<i:EventTrigger EventName="MouseLeftButtonUp">
							<i:Interaction.Behaviors>
								<ei:ConditionBehavior>
									<ei:ConditionalExpression>
										<ei:ComparisonCondition 
											Operator="NotEqual" RightOperand="-1"/>
									</ei:ConditionalExpression>
								</ei:ConditionBehavior>
							</i:Interaction.Behaviors>
							<n:NavigateAction HandlerName="ContentContainer" Url="Content/Netflix/Titles/" >
								<n:DependencyParameter Key="MovieTitles" Value="{Binding Person.TitlesDirected}"/>
								<n:DependencyParameter Key="PageTitle" 
									Value="{Binding Person.Name, StringFormat=Movies Directed By: \{0\}}"/>
							</n:NavigateAction>
						</i:EventTrigger>
					</i:Interaction.Triggers>					
					<Grid>
						<TextBlock Margin="24,0,8,0" TextWrapping="NoWrap" FontFamily="Trebuchet MS" TextTrimming="WordEllipsis"
							Text="List All" FontSize="16" Foreground="#FFA7A7A7" VerticalAlignment="Center">
							<TextBlock.Effect>
								<DropShadowEffect ShadowDepth="1" BlurRadius="2" Color="White" Direction="-247"/>
							</TextBlock.Effect>
						</TextBlock>
						<Path Data="M5.2319946,1 L5.312995,10.589 M9.5506897,7.3135071 L4.5906897,12.572507 M1,7.2724915 L5.868,12.572492" 
							HorizontalAlignment="Left" Margin="4,0,0,0" Stretch="Fill" Stroke="#FF8D8C8C" StrokeThickness="2" 
							UseLayoutRounding="False" Width="10.551" Height="13.573" VerticalAlignment="Center"/>
					</Grid>				
				</Border>
				
			</StackPanel>
		</ScrollViewer>
		
		<local_Controls:WorkingIndicator IsWorking="{Binding IsLoading}"/>
		
    </Grid>
</UserControl>
